package com.lry.basic.aop.cglib.classs;

import com.lry.basic.aop.cglib.interfaces.Select;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class UserMapperInvocationHandler implements InvocationHandler {

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Annotation[] annos = method.getAnnotations();
        for(Annotation anno:annos){
            if(anno instanceof Select){
                Select as = (Select) anno;
                System.out.println(method.getName()+" 执行sql:"+as.value());
            }
        }
        int seleteFromSql = 100;

        return seleteFromSql;
    }


}
